package com.dhcc.bpm.alarm.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dhcc.bpm.alarm.entity.AlarmNoticeTarget;
import com.dhcc.bpm.alarm.mapper.AlarmNoticeTargetMapper;
import com.dhcc.bpm.alarm.service.IAlarmNoticeTargetService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;




@Slf4j
@Service
public class AlarmNoticeTargetServiceImpl extends ServiceImpl<AlarmNoticeTargetMapper, AlarmNoticeTarget> implements IAlarmNoticeTargetService {
	
	@Autowired
	AlarmNoticeTargetMapper alarmAlertTargetMapper;

	@Transactional(rollbackFor = Exception.class)
	@Override
	public boolean removeByNoticeIds(List<Long> idList) {
		
        if (!idList .isEmpty() && idList.size() ==0) {
        	log.error("没有可删除的数据！");
        	return false;
        }
            
		QueryWrapper<AlarmNoticeTarget> deleteWrapper = new QueryWrapper<>();
	    deleteWrapper.in("notice_id", idList);
	    alarmAlertTargetMapper.delete(deleteWrapper);
	    return true;
	}
	

}
